<?php
// @todo Remove the snippet below
if(Configure::read('debug') > 0)
{
	set_time_limit(0);
}

// set profiler
Configure::write('enableProfiler', false);

// initialize cms
require_once(APP.'plugins'.DS.'cms'.DS.'bootstrap.php');

//Module sections
$blocks = array(
	'left_sidebar', 'right_sidebar', 'top', 'bottom'
);
Configure::write('availableBlocks', $blocks);

// initialize advanced config
require_once(APP.'config'.DS.'ext_config.php');
define("FFMPEG_PATH",ROOT.DS.'vendors'.DS.'ffmpeg.exe'); 
define("KM_TO_MILE_FACTOR",0.621);
$modules = cr('License.modules');
if(!$modules)
{
	$modules = array();
}
Configure::write('License.modules', $modules);
register_shutdown_function("logFatalError");
function logFatalError()
{
	$error = error_get_last();
	if($error['type'] == E_ERROR ||$error['type'] == E_CORE_ERROR)
	{
		uses("cake_log");
		$msg = $error["message"]." ".$error['file']." line:".$error['line'];
		if(isset($_SERVER['HTTP_HOST']))
		{
			$msg .= " url:http://".$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];
		}else if(php_sapi_name() == "cli")
		{
			$msg .= " shell command :".implode(" ",$_SERVER['argv']);
		}
		CakeLog::write("fatal_error",$msg);
	}
}
?>